package pro.survey.analyzer;

import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;

/**
 *
 * @author Adrian
 */
public class ProSurveyAnalyzer extends Application {
    
    @Override
    public void start(Stage primaryStage) {
        HibernateUtil.getSession();
        GUIGenerator.getInstance().createScene(primaryStage);
        primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
          @Override
          public void handle(WindowEvent we) {
              HibernateUtil.getSessionFactory().close();
          }
      }); 
    }
    
    /**
     * The main() method is ignored in correctly deployed JavaFX application.
     * main() serves only as fallback in case the application can not be
     * launched through deployment artifacts, e.g., in IDEs with limited FX
     * support. NetBeans ignores main().
     *
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }
}
